// components/hint.js
const app = getApp()
const util = require('../../utils/util.js')
Component({
        /**
         * 组件的属性列表
         */
        properties: {
                qiandao: {
                        type: Number
                },
                moneyday: {
                        type: Object,
                        value: ''
                },
                daynum:{
                        type: Number,
                        value: ''
                },
                tipinfo:{
                        type: Boolean,
                        value: false
                },
                headerheight:{
                        type:Number,
                        value:''
                },
                layershow:{
                        type:Boolean,
                        value:true
                }
        },

        /**
         * 组件的初始数据
         */
        data: {
                
        },

        /**
         * 组件的方法列表
         */
        methods: {
                baodao:function(){
                        this.setData({
                                layershow:false,
                        })
                        app.globalData.tianshu = this.data.daynum
                        var header = {
                                'authorization': wx.getStorageSync("tekon"),
                                'content-type': "application/x-www-form-urlencoded"
                        }
                        util.formhttp(app.globalData.appurl + "/mission/checkIn", 'get', '', header, (res) => {
                                var that=this
                                if (res.message == "success") {
                                        if (this.data.daynum == 6) {
                                                that.setData({
                                                        qiandao: 0,
                                                        daynum: 7,
                                                        tipinfo: true
                                                })
                                        } else {
                                                this.setData({
                                                        qiandao: that.data.daynum + 1,
                                                        daynum: that.data.daynum + 1,
                                                        tipinfo: true
                                                })
                                        }
                                        setTimeout(function () {
                                                that.setData({
                                                        tipinfo: false
                                                })
                                        }, 2000)
                                }
                        } )
                }
        }
})
